import React from 'react';
import {toggleTodo} from '../actions';
const Todo = ({index,completed,text,dispatch})=>{
    return <li style={{textDecoration:completed?'line-through':'none'}}>{text} 
    <button onClick={e=>{
        dispatch(toggleTodo(index,completed));
    }}>{completed?"完成":"未完成"}</button>
    </li>
}

export default Todo;